package com.xiweicheng.test.proxy.resp.handler;

import javax.servlet.http.HttpServletRequest;

public class RespHandlerFactory {

	private static RespHandlerFactory instance = new RespHandlerFactory();

	private RespHandlerFactory() {
	}

	public static RespHandlerFactory getInstance() {
		return instance;
	}

	public IRespHandler create(HttpServletRequest req) {

		String uri = req.getRequestURI();
		if (uri.endsWith("domain.jsp")) {
			return new DomainRespHandler();
		} else if (uri.endsWith("verify_image.jsp")) {
			return new VerifyImageRespHandler();
		} else if (uri.endsWith("web.js")) {
			return new WebRespHandler();
		} else if (uri.endsWith("loginDispatch.do")) {
			return new LoginDispatchRespHandler();
		}

		return new DefaultRespHandler();
	}
}
